<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /*量词符用来设定某个模式出现的次数
            *：重复零次或更多次
            +：重复一次或更多次
            ？：重复零次或一次
            {n}：重复n次
            {n，}：重复n次或更多次
            {n，m}：重复n到m次        
        */
       var rg =  /^a*$/
       console.log(rg.test('aaaa'));
       console.log(rg.test('a'));
       console.log(rg.test(''));

        console.log('.................................');

        var rg1 = /^a+$/;
        console.log(rg1.test('a'));
        console.log(rg1.test(''));
        console.log(rg1.test('aaaaaa'));
        console.log('.........................................');

        var rg2 = /^a?$/;
        console.log(rg2.test('aaa'));
        console.log(rg2.test('a'));
        console.log(rg2.test(''));
        console.log('...........................');

        var rg3 = /^a{3}$/;
        console.log(rg3.test('aaa'));
        console.log(rg3.test('a'));
        console.log(rg3.test(''));
        console.log(rg3.test('aaaaaaa'));
        console.log('..................................');

        var rg4 = /^a{3,}$/;  //出现三次或者更多
        console.log(rg4.test('aaa'));
        console.log(rg4.test('aaaaaa'));
        console.log('...............................');

        var rg4 = /^a{3,5}$/;  //出现三次到五次
        console.log(rg4.test('aaa'));
        console.log(rg4.test('aaaa'));
        console.log(rg4.test('aaaa'));
        console.log(rg4.test('aaaaaaa'));
        console.log(rg4.test('aa'));

    </script>
</body>
</html>